<template>
  <div class="flex">
    <!-- <vue-particles id="tsparticles" @particles-loaded="particlesLoaded" url="http://foo.bar/particles.json" /> -->
    <!-- <vue-particles id="tsparticles" @particles-loaded="particlesLoaded" :options="particlesOptions" /> -->
    <vue-particles id="tsparticles" @particles-loaded="particlesLoaded" :options="fireworksOptions" />
    <!-- <vue-particles id="tsparticles" @particles-loaded="particlesLoaded" :options="confettiOptions" /> -->
    <!-- <vue-particles id="tsparticles" @particles-loaded="particlesLoaded" :options="confettiExplosionsOptions" /> -->
    <!-- <vue-particles id="tsparticles" @particles-loaded="particlesLoaded" :options="hexagonsOptions" /> -->
  </div>
</template>
<script setup lang="ts" type="text/javascript">
import { ref } from 'vue'
import fireworksOptions from '@/assets/json/fireworks.json' // 烟花特效
import confettiOptions from '@/assets/json/confetti.json' // 纸屑特效
import confettiExplosionsOptions from '@/assets/json/confettiExplosions.json' // 纸屑爆炸特效
import hexagonsOptions from '@/assets/json/hexagons.json' // 六边形特效

const particlesLoaded = (main: any) => {
  // console.log('particles loaded', main)
}
const particlesOptions = ref({
  background: {
    color: {
      value: '#0d47a1'
    }
  },
  fpsLimit: 120,
  interactivity: {
    events: {
      onClick: {
        enable: true,
        mode: 'push'
      },
      onHover: {
        enable: true,
        mode: 'repulse'
      },
    },
    modes: {
      bubble: {
        distance: 400,
        duration: 2,
        opacity: 0.8,
        size: 40
      },
      push: {
        quantity: 4
      },
      repulse: {
        distance: 200,
        duration: 0.4
      }
    }
  },
  particles: {
    color: {
      value: '#ffffff'
    },
    links: {
      color: '#ffffff',
      distance: 150,
      enable: true,
      opacity: 0.5,
      width: 1
    },
    move: {
      direction: 'none',
      enable: true,
      outModes: 'bounce',
      random: false,
      speed: 6,
      straight: false
    },
    number: {
      density: {
        enable: true,
      },
      value: 80
    },
    opacity: {
      value: 0.5
    },
    shape: {
      type: 'circle',
      polygon: {
        nb_sides: 5
      }
    },
    size: {
      value: { min: 1, max: 5 }
    }
  },
  detectRetina: true
})
</script>
